package org.example.utils;

import org.example.common.LoginVo;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * 获取springSecurity上下文中获取用户信息
 */
public class securityContextUserInfo {

    /**
     * 获取用户信息
     * @return
     */
    public static LoginVo getContextUserInfo() {
        return (LoginVo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
